// 初始化处理template数据
const unitConf = {
    multiLang: {
        domainName: 'uapbd',
        currentLocale: 'zh-CN',
        moduleId: 'refer_uapbd',
    },
    key: 'pk_org',
    refType: 'tree',
    refName: 'refer-000176', /* 国际化处理： 行政组织*/
    placeholder: 'refer-000176', /* 国际化处理： 行政组织*/
    refCode: 'uapbd.org.AdminOrgDefaultTreeRef',
    queryTreeUrl: '/nccloud/riaorg/ref/AdminOrgDefaultTreeRef.do',
    treeConfig: {name: ['refer-000002', 'refer-000003'], code: ['refcode', 'refname']}, /* 国际化处理： 编码,名称*/
    rootNode: {refname: 'refer-000176', refpk: 'root'}, /* 国际化处理： 行政组织*/
    isMultiSelectedEnabled: false
};

const countryConf = {
    multiLang: {
        domainName: 'uapbd',
        currentLocale: 'zh-CN',
        moduleId: 'refer_uapbd',
    },
    key: 'pk_country',
    refType: 'grid',
    refName: 'refer-000444', /* 国际化处理： 国家地区EX*/
    placeholder: 'refer-000444', /* 国际化处理： 国家地区EX*/
    refCode: 'uapbd.refer.pubinfo.CountryExDefaultGridRef',
    queryGridUrl: '/nccloud/uapbd/pub/CountryExDefaultGridRef.do',
    isMultiSelectedEnabled: false,
    columnConfig: [{
        name: ['refer-000002', 'refer-000441', 'refer-000003', 'refer-000422', 'refer-000442', 'refer-000443', 'refer-000445'], /* 国际化处理： 编码,三位代码,名称,描述,时区,格式,欧盟国家*/
        code: ['refcode', 'codeth', 'refname', 'description', 'timezonename', 'formatname', 'iseucountry'],
        checked: {
            description: false,
            timezonename: false,
            formatname: false,
            iseucountry: false,
        }
    }]
};

export default function setQueryMeta() {
    let meta = this.props.meta.getMeta(), that = this;
    meta.ncc60071025query.items.forEach(item => {
        switch (item.attrcode) {
            case 'hi_psnjob.trnstype':
                item.queryCondition = function () {
                    return {
                        isShowDisable: true
                    }
                };
                break;
            case 'hi_psnjob.clerkcode':
                item.queryCondition = function () {
                    return {
                        pk_org: that.props.humanResourceOrganizationValue && that.props.humanResourceOrganizationValue.refpk,
                        func_type: 4,
                        GridRefActionExt: 'nccloud.web.hrhi.psndoc.sqlbuilder.PsndocQryDlgPsnRefSqlBuilder'
                    }
                };
                break;
            case 'hi_psnjob.pk_dept':
                item.queryCondition = function () {
                    return {
                        pk_org: that.props.humanResourceOrganizationValue && that.props.humanResourceOrganizationValue.refpk
                    }
                };
                break;
            case 'hi_psnjob.pk_post':
                item.queryCondition = unitConf.queryCondition = function () {
                    return {
                        pk_org: that.props.humanResourceOrganizationValue && that.props.humanResourceOrganizationValue.refpk,
                        TreeRefActionExt: 'nccloud.web.hrhi.pub.sqlbuilder.OrgRefNoPowerSqlBuilder'
                    }
                };
                item.isShowUnit = true;
                item.unitProps = unitConf;
                break;
            case 'hi_psndoc_psnchg.comecorpaddr':
            case 'hi_psndoc_psnchg.tocorpaddr':
            case 'nativeplace':
            case 'permanreside':
                item.isShowUnit = true;
                item.unitProps = countryConf;
                break;
            default:
                break;
        }
    });
    this.props.meta.setMeta(meta);
}
